package org.sasha.roulette.guice;

import javax.inject.Singleton;

import org.sasha.roulette.RoulettePresenter;
import org.sasha.roulette.RouletteView;
import org.sasha.roulette.RouletteViewImpl;
import org.sasha.roulette.actionbar.ActionBarPresenter;
import org.sasha.roulette.actionbar.ActionBarView;
import org.sasha.roulette.actionbar.ActionBarViewImpl;
import org.sasha.roulette.actionbar.FastSpinCreationPresenter;
import org.sasha.roulette.actionbar.FastSpinCreationView;
import org.sasha.roulette.actionbar.FastSpinCreationViewImpl;
import org.sasha.roulette.chart.ChartPresenter;
import org.sasha.roulette.chart.ChartView;
import org.sasha.roulette.chart.ChartViewImpl;
import org.sasha.roulette.data.ChartHelper;
import org.sasha.roulette.data.DBHelper;
import org.sasha.roulette.dialog.SpinDialogPresenter;
import org.sasha.roulette.dialog.SpinDialogView;
import org.sasha.roulette.dialog.SpinDialogViewImpl;
import org.sasha.roulette.feed.ColorFeedPresenter;
import org.sasha.roulette.feed.ColorFeedView;
import org.sasha.roulette.feed.ColorFeedViewImpl;

import com.google.common.eventbus.EventBus;
import com.google.inject.AbstractModule;
import com.vaadin.Application;

public class RouletteModule extends AbstractModule {

    private Application app;
    
    public RouletteModule(final Application app) {
        this.app = app;
    }
    
    @Override
    protected void configure() {
        bind(RouletteView.class).to(RouletteViewImpl.class);
        bind(SpinDialogView.class).to(SpinDialogViewImpl.class);
        bind(ColorFeedView.class).to(ColorFeedViewImpl.class);
        bind(ChartView.class).to(ChartViewImpl.class);
        bind(ActionBarView.class).to(ActionBarViewImpl.class);
        bind(FastSpinCreationView.class).to(FastSpinCreationViewImpl.class);
        
        bind(DBHelper.class).in(Singleton.class);
        bind(ChartHelper.class).in(Singleton.class);
        bind(EventBus.class).in(Singleton.class);
        
        bind(ActionBarPresenter.class);
        bind(ChartPresenter.class);
        bind(RoulettePresenter.class);
        bind(ColorFeedPresenter.class);
        bind(SpinDialogPresenter.class);
        bind(FastSpinCreationPresenter.class);
        
        bind(Application.class).toInstance(app);
    }
}
